#region Using

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;

using Gizmox.WebGUI.Common;
using Gizmox.WebGUI.Forms;

#endregion

namespace Bronze.ReportBuilder.BusinessComponent
{
    public partial class LabelCombobox : LabelFormControl
    {
        public LabelCombobox()
        {
            InitializeComponent();
            
            ComboBox.ValueMember = "Value";
            ComboBox.DisplayMember = "Text";
            this.ComboBox.SelectedIndexChanged += new EventHandler(ComboBox_SelectedIndexChanged);
        }


        protected virtual void ComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (BindCompleted)
            {
                OnSelectedChanged(e);
            }
        }

        public override Control HostControl
        {
            get
            {
                return this.ComboBox;
            }
        }

        public override bool AllowSelectMore
        {
            get
            {
                return false;
            }
        }

        public override object Value
        {
            get
            {
                return this.ComboBox.SelectedValue;
            }
            set
            {
                this.ComboBox.SelectedValue = value;
            }
        }


        public override Control Create(string name)
        {
            return new LabelCombobox();
        }
    }
}